package com.tf.xx.controller;


import com.tf.xx.R;
import com.tf.xx.service.OssService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Tag(name = "oss", description = "文件上传接口")
@RestController
@RequestMapping("/edu_oss/fileoss")
public class OssController {
    @Autowired
    private OssService ossService;
    @PostMapping("/upload")
    public R uploadFile(@RequestParam(name = "file")MultipartFile  file){
        String url = ossService.uploadFileAvatar(file);
        return R.ok().data("url",url).message("上传成功");
    }
}
